<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2615：超级斗兽棋</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">超级斗兽棋</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">超级斗兽棋</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                超级斗兽棋                </h1>
                <p>时间限制：10s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：128MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div style="line-height: 150%"><span style="font-size: 12pt; line-height: 150%">&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt; line-height: 150%">斗兽棋是一项有趣的棋类游戏。双方分别控制一些动物，在棋盘上按照一定的规则轮流行动，先占领对方巢穴为胜。任意两种不同的动物</span><span style="font-size: 12pt; line-height: 150%">A</span><span style="font-size: 12pt; line-height: 150%">和</span><span style="font-size: 12pt; line-height: 150%">B</span><span style="font-size: 12pt; line-height: 150%">相遇，要么</span><span style="font-size: 12pt; line-height: 150%">A</span><span style="font-size: 12pt; line-height: 150%">胜</span><span style="font-size: 12pt; line-height: 150%">B</span><span style="font-size: 12pt; line-height: 150%">，要么</span><span style="font-size: 12pt; line-height: 150%">B</span><span style="font-size: 12pt; line-height: 150%">胜</span><span style="font-size: 12pt; line-height: 150%">A</span><span style="font-size: 12pt; line-height: 150%">。</span></div>
<div style="line-height: 150%"><span style="font-size: 12pt; line-height: 150%">&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt; line-height: 150%">不过，原先的斗兽棋中动物种类较少，玩久了就会略显无聊。于是，某公司决定开发一种超级斗兽棋，含有</span><span style="font-size: 12pt; line-height: 150%">N</span><span style="font-size: 12pt; line-height: 150%">种动物，编号为</span><span style="font-size: 12pt; line-height: 150%">1,2</span><span style="font-size: 12pt; line-height: 150%">，&hellip;&hellip;，</span><span style="font-size: 12pt; line-height: 150%">N</span><span style="font-size: 12pt; line-height: 150%">，并已经制定好了任意两种不同动物相遇时的胜负关系。</span></div>
<div style="line-height: 150%"><span style="font-size: 12pt; line-height: 150%">&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt; line-height: 150%">下一步工作是测试超级斗兽棋的趣味性。经调查发现，若动物间相互制约，则游戏的趣味性将大大增加。所谓动物间相互制约，即可以将动物按某种次序排成一个序列</span><span style="font-size: 12pt; line-height: 150%">P1</span><span style="font-size: 12pt; line-height: 150%">，</span><span style="font-size: 12pt; line-height: 150%">P2</span><span style="font-size: 12pt; line-height: 150%">，&hellip;&hellip;，</span><span style="font-size: 12pt; line-height: 150%">Pn</span><span style="font-size: 12pt; line-height: 150%">，满足</span><span style="font-size: 12pt; line-height: 150%">P1</span><span style="font-size: 12pt; line-height: 150%">胜</span><span style="font-size: 12pt; line-height: 150%">P2</span><span style="font-size: 12pt; line-height: 150%">，</span><span style="font-size: 12pt; line-height: 150%">P2</span><span style="font-size: 12pt; line-height: 150%">胜</span><span style="font-size: 12pt; line-height: 150%">P3</span><span style="font-size: 12pt; line-height: 150%">，&hellip;&hellip;，</span><span style="font-size: 12pt; line-height: 150%">P</span><span style="font-size: 12pt; line-height: 150%">（</span><span style="font-size: 12pt; line-height: 150%">n-1</span><span style="font-size: 12pt; line-height: 150%">）胜</span><span style="font-size: 12pt; line-height: 150%">Pn</span><span style="font-size: 12pt; line-height: 150%">，</span><span style="font-size: 12pt; line-height: 150%">Pn</span><span style="font-size: 12pt; line-height: 150%">胜</span><span style="font-size: 12pt; line-height: 150%">P1</span><span style="font-size: 12pt; line-height: 150%">。如果动物间不能相互制约，但可以半相互制约（在相互制约的条件中去掉&ldquo;</span><span style="font-size: 12pt; line-height: 150%">Pn</span><span style="font-size: 12pt; line-height: 150%">胜</span><span style="font-size: 12pt; line-height: 150%">P1<span>&rdquo;</span>，其他条件不变）的话，那么这款游戏虽然趣味性有所降低，但勉强可以接受。不过，如果连半相互制约都不能满足的话，呵呵，对不起，重新设计吧。</span></div>
<div style="line-height: 150%"><span style="font-size: 12pt; line-height: 150%">&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt; line-height: 150%">你的任务就是帮助测试这款超级斗兽棋的趣味性。</span></div>
<div style="line-height: 150%">&nbsp;</div></p><hr/><h3>输入格式</h3><p><div style="line-height: 150%"><span style="font-size: 12pt; line-height: 150%">第一行是一个整数</span><span style="font-size: 12pt; line-height: 150%">n</span><span style="font-size: 12pt; line-height: 150%">，表示动物种类数。接下来是一个</span><span style="font-size: 12pt; line-height: 150%">n*n</span><span style="font-size: 12pt; line-height: 150%">的矩阵，为动物间的胜负关系，第</span><span style="font-size: 12pt; line-height: 150%">i</span><span style="font-size: 12pt; line-height: 150%">行第</span><span style="font-size: 12pt; line-height: 150%">j</span><span style="font-size: 12pt; line-height: 150%">列为</span><span style="font-size: 12pt; line-height: 150%">1</span><span style="font-size: 12pt; line-height: 150%">则</span><span style="font-size: 12pt; line-height: 150%">i</span><span style="font-size: 12pt; line-height: 150%">胜</span><span style="font-size: 12pt; line-height: 150%">j</span><span style="font-size: 12pt; line-height: 150%">，为</span><span style="font-size: 12pt; line-height: 150%">0</span><span style="font-size: 12pt; line-height: 150%">则</span><span style="font-size: 12pt; line-height: 150%">j</span><span style="font-size: 12pt; line-height: 150%">胜</span><span style="font-size: 12pt; line-height: 150%">i</span><span style="font-size: 12pt; line-height: 150%">（保证胜负关系不会矛盾，即不同的</span><span style="font-size: 12pt; line-height: 150%">i</span><span style="font-size: 12pt; line-height: 150%">和</span><span style="font-size: 12pt; line-height: 150%">j</span><span style="font-size: 12pt; line-height: 150%">相遇有且仅有一个胜者；主对角线上全为</span><span style="font-size: 12pt; line-height: 150%">0</span><span style="font-size: 12pt; line-height: 150%">）。</span></div>
<div style="line-height: 150%">&nbsp;</div>
<div style="line-height: 150%"><span style="font-size: 12pt; line-height: 150%">第一行是一个整数</span><span style="font-size: 12pt; line-height: 150%">s</span><span style="font-size: 12pt; line-height: 150%">，表示测试结果：</span><span style="font-size: 12pt; line-height: 150%">0</span><span style="font-size: 12pt; line-height: 150%">表示动物间相互制约，</span><span style="font-size: 12pt; line-height: 150%">1</span><span style="font-size: 12pt; line-height: 150%">表示动物间不相互制约但半相互制约，</span><span style="font-size: 12pt; line-height: 150%">-1</span><span style="font-size: 12pt; line-height: 150%">表示都不满足。若测试结果不为</span><span style="font-size: 12pt; line-height: 150%">-1</span><span style="font-size: 12pt; line-height: 150%">，则在第二行输出满足响应条件的任一序列</span><span style="font-size: 12pt; line-height: 150%">P</span><span style="font-size: 12pt; line-height: 150%">（即测试结果为</span><span style="font-size: 12pt; line-height: 150%">0</span><span style="font-size: 12pt; line-height: 150%">时输出满足相互制约条件的序列，为</span><span style="font-size: 12pt; line-height: 150%">1</span><span style="font-size: 12pt; line-height: 150%">时输出半相互制约条件的序列）。</span></div>
<div style="line-height: 150%">&nbsp;</div></p><hr/><h3>输出格式</h3><p><div><span style="font-size: 12pt">5</span></div>
<div><span style="font-size: 12pt">0 0 1 1 1 </span></div>
<div><span style="font-size: 12pt">1 0 1 1 0 </span></div>
<div><span style="font-size: 12pt">0 0 0 1 0 </span></div>
<div><span style="font-size: 12pt">0 0 0 0 1 </span></div>
<div><span style="font-size: 12pt">0 1 1 0 0</span></div>
<div style="line-height: 150%">&nbsp;</div></p><hr/><h3>样例输入</h3><pre>0
1 3 4 5 2
 
</pre><hr/><h3>样例输出</h3><pre></pre><hr/><h3>提示</h3><p><p>100%的数据，2&lt;=n&lt;=200</p>
<p>请不要提交，期待SPJ</p></p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2615" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2615" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>